Skip to content

feat: structured AI responses, review file exclusions, and commit status checks#18

Merged
GodsBoy merged 4 commits intomainfrom
feat/phase4-foundations
Mar 28, 2026
Merged

feat: structured AI responses, review file exclusions, and commit status checks#18
GodsBoy merged 4 commits intomainfrom
feat/phase4-foundations

Conversation

@GodsBoy
Copy link
Copy Markdown
Owner

@GodsBoy GodsBoy commented Mar 27, 2026

Summary

Phase 4 foundation features that improve AI provider observability, review configurability, and CI enforcement:

  • Structured AI Provider InterfaceAIProvider.complete() now returns AIResponse with token usage (inputTokens/outputTokens) and supports per-call maxTokens option. All three providers (Claude, OpenAI, Ollama) updated. Foundation for cost tracking and budget controls.
  • Review File Exclusions — Glob-pattern-based file filtering via codeReview.ignore config. Supports *, **, ? patterns with proper regex metacharacter escaping. Skips review entirely when all changed files are excluded.
  • Commit Status Checks — Posts GitHub commit status (pass/fail) after code review based on BLOCKING findings severity. Controlled via codeReview.commitStatus config flag. Transforms RepoKeeper from advisory to enforceable merge gate.

Changes

  • src/ai/provider.ts — New AIResponse, AIUsage, AIRequestOptions interfaces
  • src/ai/claude.ts, openai.ts, ollama.ts — Return structured responses with token usage
  • src/review/reviewer.tsmatchesIgnorePattern(), filterIgnoredFiles(), filterDiffByFiles(), buildCommitStatus()
  • src/github/client.tscreateCommitStatus() method
  • src/config.ts — Added ignore and commitStatus defaults
  • 18 new tests (112 total, all passing)

Test plan

  • pnpm build — zero TypeScript errors
  • pnpm test — 112/112 tests passing
  • All AI callers updated to destructure { text } from AIResponse
  • Ignore pattern tests cover: exact paths, wildcards, globstar, directory patterns, ? wildcard, dots, regex metacharacters ([], (), +)
  • Commit status tests via extracted buildCommitStatus() function

GodsBoy added 4 commits March 28, 2026 00:23
Replace the plain string return from AIProvider.complete() with a
structured AIResponse containing text and usage (inputTokens,
outputTokens). Update all three providers (Claude, OpenAI, Ollama),
all callers, and all test mocks to use the new shape.
Add ignore glob patterns to CodeReviewConfig so specific files
(e.g. lock files, generated code, dist/) can be excluded from
AI code review. Filtered files are also excluded from the diff
sent to the AI provider and from context building.
Add optional commitStatus flag to CodeReviewConfig. When enabled,
the reviewer posts a GitHub commit status after each review:
failure if any BLOCKING findings exist, success otherwise. This
allows branch protection rules to require passing reviews.
…ct buildCommitStatus

- matchesIgnorePattern now escapes [](){}+^$|\ before converting glob to regex
- Extract buildCommitStatus() as testable function instead of inline logic
- Tests call the real function instead of duplicating implementation
@GodsBoy GodsBoy merged commit 2eff847 into main Mar 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant